package com.guodexiain.nyiotclient.controller;

import com.guodexiain.nyiotclient.model.User;
import com.guodexiain.nyiotclient.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class LoginController {
    @Autowired
    private UserService userService;
    @RequestMapping("/test/login")
    @ResponseBody
    public  String login(@RequestBody User user){
        if (userService.findUserByNameAndPwd(user) != null){
           return "{\"code\":0}";
        }else {
            return "{\"code\":1}";
        }

    }
}
